"""
URL configuration for mysite project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
# 导入Django内置的管理后台模块
from django.contrib import admin

# 导入URL路径配置相关工具：
# path - 用于定义单个URL路径
# include - 用于引入其他应用的URL配置
from django.urls import path, include
#内置的认证视图 接收前端传来的账号密码
from django.contrib.auth import views as auth_views

# 定义项目的URL映射规则
urlpatterns = [
    # 将 /admin/ 开头的请求路由到Django管理后台
    # 例如访问 http://域名/admin/ 会进入管理员界面
    path('admin/', admin.site.urls),
    path('crawler/', include('crawler.urls')),
    # 登录页面 登录视图auth_views.LoginView.as_view 对应登录html文件
    path('accounts/login/', auth_views.LoginView.as_view(
        template_name='registration/login.html',
        extra_context={'system_name': '彩票数据系统'}
    ), name='login'),
    # 退出页面
    path('accounts/logout/', auth_views.LogoutView.as_view(), name='logout'),



    # 将 /tasks/ 开头的请求转发给tasks应用处理
    # include()表示引入tasks应用内部的urls.py配置
    # 相当于把/tasks/路径下的所有子路由委托给tasks应用自己管理
    #path('tasks/', include('tasks.urls')),
    # 网站根路径的请求路由到demo应用处理
    #path('demo/', include('demo.urls')),
    #path('bookstore/', include('bookstore.urls')),
    #path('polls/', include('polls.urls')),
    #path("polls/", include("django_polls.urls")),
    #path("polls/", include("polls.urls")),

]
